package com.example.xln111.service;

import com.example.xln111.Dao.GradeMapper;
import com.example.xln111.Dao.StudentMapper;
import com.example.xln111.model.Grade;
import com.example.xln111.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GradeService {
        @Autowired
        private GradeMapper GradeDao;

        public List<Grade> getAllGrades(){
            return GradeDao.getAll();
        }

        public int add(Grade grade){
            return GradeDao.addGrade(grade);
        }

        public int update(Grade grade){
            return GradeDao.updateGrade(grade);
        }

        public int deleteById(int studentId){ return GradeDao.deleteGradeById(studentId);}

        public Grade getById(int studentId){
            return GradeDao.getGradeById(studentId);
        }
    }

